#include "threadPool.hpp"
#include <unistd.h>
#include <stdlib.h>
#include <time.h>

int main()
{
    srand((unsigned int)time(nullptr));
    // 创建线程池
    ThreadPool<Task> tp;
    // 启动线程
    tp.run(); 
    // 插入任务
    while(true)
    {
        int x = rand() % 10;
        usleep(1000);  
        int y = rand() % 10;
        Task t(x, y);
        // static int task = 1;
        std::cout << "生产任务：" << t._x << " + " << t._y << " = " << std:: endl;
        tp.push(t);
        sleep(1);
    }

    return 0;
}